#pragma once
#ifndef skyTimer_h__
#define skyTimer_h__

#include "./skyAdapter.h"

#ifdef _SYMBIAN
#include "./symbian/symTimer.h"
#else
#include "./windows/winTimer.h"
#endif

namespace Sky
{
	class Timer : public OSTimer
	{
	public:
		typedef fastdelegate::FastDelegate0<> TimerCallback;
		~Timer();
		TBool CreateTimer(TInt MicroSeconds,TimerCallback callback,TBool bRepeat = vTrue);
		TVoid DeleteTimer(TimerCallback callback);
		static TInt Run( void * aPtr );
		TVoid onTimer();
	protected:
		typedef struct _CallbackNode_
		{
			TimerCallback _cb;
			TUint _interal;
			TUint _left;
			TBool _bRepeat;
		}CallbackNode;
		typedef List<CallbackNode> CBList;
		CBList _list;
	};
	
	typedef RefPtr<Timer> TimerPtr;
}
#endif
